<div th:fragment="edit">

    <div class="modal fade" id="myModal"  tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">编辑用户</h4>
                </div>
                <input type="hidden"  id ="id" name="id">
                <div class="modal-body">
                    <div class="form-group">
                        <label for="name" class="control-label">任务名称:</label>
                        <input type="text" class="form-control"  id="name" name="name">
                    </div>

                    <div class="form-group">
                        <label for="className" class="control-label">请输入要执行的方法全路劲:</label>
                        <input type="text" class="form-control"   placeholder="请输入密码"  id="className" name="className">
                    </div>

                    <div class="form-group">
                        <label for="cron" class="control-label">执行表达式:</label>
                        <input type="text" class="form-control"  placeholder="请输入名称"  id="cron" name="cron">
                    </div>
                    <div class="form-group">
                        <label for="remarks" class="control-label">备注:</label>
                        <input type="text" class="form-control"  placeholder="请输入名称"  id="remarks" name="remarks">
                    </div>

                </div>
                <div class="modal-footer">
                    <button id="edit" type="button" class="btn btn-success">确定</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>

            </div>
        </div>
    </div>

    <script>
       //加載用戶編輯彈框
       function EditViewById(id){
           $('#myModal').modal();
           const data = {
               id: id
           };
           myrequest("/admin/taskConf/details",data,'GET',function(data){
               $("#name").val(data.data.name);
               $("#className").val(data.data.className);
                $("#cron").val(data.data.cron);
               $("#remarks").val(data.data.remarks);
               $("#id").val(data.data.id);
           }, function(data){
               toastr.error(data.msg);
           })
       }
        //点击保存按钮
        $("#edit").click(function(){

            const id = $("input[name='id']").val();//获取表单form1的用户名的值
            const name = $("input[name='name']").val();//获取表单form1的用户名的值
            const className = $("input[name='className']").val();//获取表单form1密码值
            const cron = $("input[name='cron']").val();//获取表单form1密码值
            const remarks = $("input[name='remarks']").val();//获取表单form1密码值
            const data = {
                id: id,
                name: name,
                className: className,
                cron:cron,
                remarks:remarks
            };
            //提交后台保存用户数据
            myrequest("/admin/taskConf/edit",data,'POST',function(data){
                $('#myModal').modal('hide')
                toastr.success(data.msg);
                $("#table").bootstrapTable('refresh');
            }, function(data){
                $('#myModal').modal('hide')
                toastr.error(data.msg);
            })
        });

    </script>

</div>